<% add_decidim_page_title(t(".invites")) %>

<div class="card" id="conference-invites">
  <div class="item_show__header">
    <h1 class="item_show__header-title">
      <%= t(".invites") %>
      <%= link_to t(".invite_attendee"), conference.registrations_enabled ? new_conference_conference_invite_path(conference) : "#", class: "button button__sm button__secondary #{"disabled" unless conference.registrations_enabled && allowed_to?(:invite_attendee, :conference, conference:)}" %>
    </h1>
  </div>

  <%= admin_filter_selector %>

  <div class="table-scroll">
    <table class="table-list">
      <thead>
        <tr>
          <th><%= t("models.conference_invite.fields.name", scope: "decidim.conferences") %></th>
          <th><%= t("models.conference_invite.fields.email", scope: "decidim.conferences") %></th>
          <th><%= t("models.conference_invite.fields.sent_at", scope: "decidim.conferences") %></th>
          <th><%= t("models.conference_invite.fields.status", scope: "decidim.conferences") %></th>
          <th><%= t("models.conference_invite.fields.registration_type", scope: "decidim.conferences") %></th>
        </tr>
      </thead>
      <tbody>
        <% @conference_invites.each do |invite| %>
          <% presenter = Decidim::Conferences::ConferenceInvitePresenter.new(invite) %>
          <tr data-id="<%= invite.id %>">
            <td>
              <%= invite.user.name %>
            </td>
            <td>
              <%= invite.user.email %>
            </td>
            <td>
              <% if invite.sent_at %>
                <%= l invite.sent_at, format: :decidim_short %>
              <% end %>
            </td>
            <td class="<%= presenter.status_html_class %>">
              <%= presenter.status %>
            </td>
            <td>
              <%= translated_attribute(invite.registration_type.title) %>
            </td>
          </tr>
        <% end %>
      </tbody>
    </table>
  </div>
  <%= decidim_paginate @conference_invites %>
</div>
